package com.xgk.boot.module.core.framework.token.config;

import cn.hutool.core.util.StrUtil;
import com.xgk.boot.framework.common.util.jwt.JwtUtil;
import com.xgk.boot.module.core.framework.sms.config.SmsCodeProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties(TokenProperties.class)
public class TokenConfiguration {


    public TokenConfiguration(TokenProperties tokenProperties){
        if(StrUtil.isNotBlank(tokenProperties.getSecretKey())){
            JwtUtil.updateSecretKey(tokenProperties.getSecretKey());
        }
        JwtUtil.updateNearExpiretionTime(tokenProperties.getNearExpireTime());
    }
}
